package com.atguigu.daijia.order.client;

import com.atguigu.daijia.common.result.Result;
import com.atguigu.daijia.model.entity.order.OrderMonitor;
import com.atguigu.daijia.model.entity.order.OrderMonitorRecord;
import com.atguigu.daijia.order.client.fallback.OrderMonitorFeignClientFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;


@FeignClient(value = "service-order", fallbackFactory = OrderMonitorFeignClientFallbackFactory.class)
public interface OrderMonitorFeignClient {
    /**
     * 保存订单监控记录到 MongoDB
     * @param orderMonitorRecord
     * @return
     */
    @PostMapping("/order/monitor/saveOrderMonitorRecord")
    Result<Boolean> saveOrderMonitorRecord(@RequestBody OrderMonitorRecord orderMonitorRecord);

    /**
     * 保存订单订单监控统计记录
     * @param orderMonitor
     * @return
     */
    @PostMapping("/order/monitor/saveOrderMonitor")
    Result<Long> saveOrderMonitor(@RequestBody OrderMonitor orderMonitor);

    /**
     * 根据订单 ID 查询订单监控统计记录
     * @param orderId
     * @return
     */
    @GetMapping("/order/monitor/getOrderMonitor/{orderId}")
    Result<OrderMonitor> getOrderMonitorByOrderId(@PathVariable("orderId") Long orderId);


    /**
     * 更新订单监控统计记录
     * @param orderMonitor
     * @return
     */
    @PostMapping("/order/monitor/updateOrderMonitor")
    Result<Boolean> updateOrderMonitor(@RequestBody OrderMonitor orderMonitor);
}